package Game;

public final class SceneManager {
	
	enum Scenes
	{
		OPENING,
		MENU,
		PLAYING,
		CONGRATS,
		GAMEOVER
	}
	
	private static Scenes actualScene;
	public static Scene scene;
	
	public static int actualLevel;
	
	private SceneManager() {}
	
	public static void Setup()
	{
		actualScene = Scenes.MENU;
		scene = new Menu();
	}
	
	public static void ChangeScene()
	{
		System.out.print("Mudou para cena - ");
		switch(actualScene)
		{
			case OPENING:
				
				break;
			case MENU:
				
				actualScene = Scenes.PLAYING;
				scene = new Level01();
				actualLevel = 1;
				
				break;
			case PLAYING:
				
				if(Level.saiu)
				{
					scene = new Menu();
					actualScene = Scenes.MENU;
				}
				else if(Level.perdeu)
				{
					scene = new GameOver();
					actualScene = Scenes.GAMEOVER;
				}
				else if(Level.ganhou)
				{
					scene = new Congrats();
					actualScene = Scenes.CONGRATS;
				}
				
				break;
			case CONGRATS:
				
				if(actualLevel == 1)
				{
					scene = new Level02();
					actualScene = Scenes.PLAYING;
					actualLevel = 2;
				}
				else if(actualLevel == 2)
				{
					scene = new Level03();
					actualScene = Scenes.PLAYING;
					actualLevel = 3;
				}
				else
				{
					scene = new Menu();
					actualScene = Scenes.MENU;
					actualLevel = 0;
				}
				
				break;
			case GAMEOVER:
				
				if(GameOver.restartLevel)
				{
					if(actualLevel == 1)
					{
						scene = new Level01();
						actualScene = Scenes.PLAYING;
					}
					else if(actualLevel == 2)
					{
						scene = new Level02();
						actualScene = Scenes.PLAYING;
					}
					else if(actualLevel == 3)
					{
						scene = new Level03();
						actualScene = Scenes.PLAYING;
					}
				}
				else
				{
					scene = new Menu();
					actualScene = Scenes.MENU;
					actualLevel = 0;
				}				
				
				break;
		}
	}
}